<template>
  <div>
    <el-main>
      <yemian @handleSubmit="add" fromURL="add"></yemian>
    </el-main>
  </div>


  <!--  <Yemian age={{age}} salary={{salary}} username={{username}}></Yemian>-->
</template>


<script>
import Yemian from '@/components/Yemian.vue'

export default {
  name: 'add',
  components: {
    'yemian': Yemian
  },
  data: function () {
    return {
      users: {
        name: '',
        salary: null,
        age: null,
        // id: localStorage.getItem('id'),
        id: this.$store.state.id,
      }
    }
  },

  methods: {
    add: function (formName) {
      this.$store.commit('addems', formName)
      this.$router.push({
          name: 'Ems',
        })
          // let tableData_json1 = localStorage.getItem('tableData_json')
          // //反序列化为对象
          // let tableData = JSON.parse(tableData_json1)
          //
          // // if (!this.id) {
          // //   this.id = 1
          // // }
          // if (!tableData) {
          //   tableData = []
          // }
          //
          // tableData.push(formName)
          //
          //
          // let tableData_json = JSON.stringify(tableData)
          // localStorage.setItem('tableData_json', tableData_json)
          //
          // this.$router.push({
          //   name: 'Ems',
          // })



    }
  },

}
</script>